<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <router-link to='/home' tag='button'>home</router-link>
        <router-link to='/news'tag='button'>news</router-link>
        <router-link to='/me' tag='button'>me</router-link>
        <router-view></router-view>
    </div>
</body>
<script src="./vue.js"></script>
<script src="./vue-router.js"></script>
<script>
    const home={
        template:`
            <div>
                <span>我是home页</span>
            </div>
        `
    }
    const news={
        template:`
            <div>
                <span>我是news页</span>
            </div>
        `
    }
    const me={
        template:`
            <div>
                <span>我是me页</span>
            </div>
        `
    }
    const routes=[
        {
            path:'/home',
            component:home
        },
        {
            path:'/news',
            component:news
        },
        {
            path:'/me',
            component:me
        }
    ]
    const router=new VueRouter({
        routes
    })
    const vm=new Vue({
        el:'#app',
        router

    })
</script>
</html>